package lab1;

import java.util.Random;

public class Lab_01 {
    public static void main(String[] args) {
        Random random = new Random();
        int numberOfQuestions = 50;
        int range = 100;

        for (int i = 1; i <= numberOfQuestions; i++) {
            int num1 = random.nextInt(range);
            int num2 = random.nextInt(range);
            int operator = random.nextInt(2); // 0 for addition, 1 for subtraction

            if (operator == 0) {
                System.out.println("习题 " + i + ": " + num1 + " + " + num2 + " = ?");
            } else {
                // Ensure subtraction result is non-negative
                if (num1 < num2) {
                    int temp = num1;
                    num1 = num2;
                    num2 = temp;
                }
                System.out.println("习题 " + i + ": " + num1 + " - " + num2 + " = ?");
            }
        }
    }
}
